<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计算任意数的阶乘n! 1*2*3*4*5...*n</title>
</head>
<body>
    
</body>
<script>
    //计算任意数的阶乘n! 1*2*3*4*5...*n

    function factorial(n) {
        var result = 1;
        for(var i = n; i >= 1; i--) {
            result *= i;
        }
        return result;
    }

    console.log('6的阶乘是:' + factorial(6));



</script>
</html>